<template>
	<view class="page">
		<view class="title">
			<view class="mycard">
					<image :src="user.avatarUrl?user.avatarUrl:'/static/imgs/head1.png'" mode="aspectFill"></image>
					<view class="uname">{{user.nickName}}</view>
					<view class="uinfo"></view>
			</view>
		</view>
		
		<view class="mysetting">
			<view class="itemicon" @tap="go_fav">
				<image src="/static/imgs/shoucang.png" mode="aspectFill"></image>
				<text>我的收藏</text>
			</view>
			<view class="itemicon" @tap="zanwu">
				<image src="/static/imgs/dianzan.png" mode="aspectFill"></image>
				<text>我赞过的</text>
			</view>
			<view class="itemicon" @tap="zanwu">
				<image src="/static/imgs/pinglun.png"  mode="aspectFill"></image>
				<text>我的评价</text>
			</view>
			<view class="itemicon" @tap="zanwu">
				<image src="/static/imgs/haoyou.png" mode="aspectFill"></image>
				<text>邀请好友</text>
			</view>
			<navigator url="/pages/my/setting">
			<view class="itemicon">
				<image src="/static/imgs/shezhi.png" mode="aspectFill"></image>
				<text>设置</text>
			</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	export default{
		data (){
			return{
				user:{}
			}
		},
		onShow() {
			var _this = this;
			uni.getStorage({
				key:"userInfo",
				success(e) {
					_this.user =JSON.parse(e.data) ;
					if(!_this.user.uid){
						
					}
				},fail: (err) => {
					let premise = uni.showToast({
						icon:"none",
						title:"未登录！"
					})
					setTimeout(()=>{
						uni.redirectTo({
							url: '/pages/public/login/login'
						})
					},1500)
					
				}
			})
		},
		methods:{
			go_fav(){
				uni.switchTab({
					url:"/pages/fav/fav"
				})
			},
			zanwu(){
				uni.getStorage({
					key:"userInfo",
					success(e) {
						_this.user = e.data;
						console.log(e.data);
					}
				})
				uni.showToast({
					title:"暂未开通",
					icon:"none"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.title{
		width: 100%;
		height: 440upx;
		background-image: url('~@/static/imgs/bg.png');
		position: relative;
		background-size: 100% 100%;
		padding-top: 80upx;
		box-sizing: border-box;
		.mycard{
			width: 672upx;
			height: 332upx;
			background-image: url('~@/static/imgs/center.png');
			margin: 0upx auto;
			background-size: 100% 100%;
			display: flex;
			justify-content: center;
			align-items: center;
			flex-direction:column;
				image{
					width: 160upx;
					height: 160upx;
					border-radius: 160upx;
					display: block;
				}
			.uname{
				width: 100%;
				font-size: 36upx;
				text-align: center;
				color: #666;
				display: block;
			}
			.uinfo{
				width: 100%;
				font-size: 28upx;
				color: darkgray;
				text-align: center;
				display: block;
				
			}
		}
	}
	.mysetting{
		width: 100%;
		height: auto;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		
		.itemicon{
			width: 250upx;
			height: 198upx;
			image{
				width: 64upx;
				height: 64upx;
				margin: 32upx auto;
				display: block;
			}
			text{
				font-weight: bold;
				color: #666;
				font-size: 36upx;
				text-align: center;
				line-height: 60upx;
				display: block;
				width: 100%;
				height: 60upx;
			}
		}
	}
</style>
